package cn.kgc.itrip.auth.service;

import cn.kgc.itrip.beans.pojo.ItripUser;

public interface UserService {

    String ACTIVE_CODE_KEY_PREFIX = "active:";

    /**
     * 第三方用户注册
     * @param itripUser
     * @throws Exception
     */
    void registerThirdUser(ItripUser itripUser)throws Exception;

    /**
     * 检查第三方用户是否已经注册
     * @param id
     * @return
     * @throws Exception
     */
    ItripUser checkUserByOpenId(String id)throws Exception;

    /**
     * 用户登录
     * @param name
     * @param password
     * @return
     * @throws Exception
     */
    ItripUser login(String name, String password)throws Exception;

    /**
     * 检查激活码
     * @param user
     * @param code
     * @return
     * @throws Exception
     */
    boolean checkActiveCode(String user, String code)throws Exception;

    /**
     * 激活用户
     * @param itripUser
     * @throws Exception
     */
    void activeUser(ItripUser itripUser)throws Exception;

    /**
     * 手机注册用户
     * @param itripUser
     * @throws Exception
     */
    void registerUser(ItripUser itripUser)throws Exception;

    /**
     * 检查用户是否存在
     * @param phone 用户手机号
     * @return
     * @throws Exception
     */
    ItripUser checkUserIsExists(String phone)throws Exception;

    /**
     * 邮箱注册用户
     * @param itripUser
     * @throws Exception
     */
    void doRegisterUser(ItripUser itripUser)throws Exception;
}
